<template>
  <div class='container'>
    <el-dialog title="预览文章" :visible.sync="showDialog">
      <div class="head">
        <h2>{{data.title}}</h2>
          <div>
            <span>{{data.createTime|parseTimeByString}}</span>
            <span>{{data.username}}</span>
            <span class="el-icon-view"></span>
            <span>{{data.visits}}</span>
          </div>
      </div>
       <div class="body" v-html="data.articleBody"></div>
    </el-dialog>
    </div>
</template>

<script>
export default {
  name: 'ArticlesPreview',
  props: ['data'],
  data () {
    return {
      showDialog: false
    }
  },
  methods: {
    openDialog () {
      this.showDialog = true
    }
  }
}
</script>

<style scoped lang='scss'>
.head {
 border-bottom: 1px dashed #ccc;
 padding-bottom: 10px;
 h2 {
   margin: 0;
   padding: 0;
 }
}
.body {
  background: #f5f5f5;
  padding: 10px;
}
</style>
